import { http } from '../utils/http'

import type { User } from '/@/types/member'
export const getUserInfo = () => {

	return http<User>(
		{
			method: 'GET',
			url: "/app/user/login"
		})
}

export const loginByWechat = (code : string) => {

	return http(
		{
			method: 'GET',
			url: `/app/user/wechatSession/${code}`

		})
}
export const sendPhone = (phone : string) => {

	return http(
		{
			method: 'POST',
			url: `/app/user/sendPhoneCode/${phone}`

		})
}
export const sendEmail = (email : string) => {

	return http(
		{
			method: 'POST',
			url: `/app/user/sendMailCode/${email}`

		})
}

export const login= (phone : string|null, email:string|null , code : string) => {

	return http<User>(
		{
			method: 'POST',
			url: `/app/user/login`,
			data: {
				email:email,
				phone: phone,
				code: code,
			}

		})
}
